<?php //settings.php

global $CFG;

//require_once($CFG->dirroot.'/mod/podcast/lib.php');

$settings->add(new admin_setting_heading('test', get_string('source','podcast'), ''));

$options = array('LINKING_ONLY' => utf8_encode(trim(get_string('linkingOnly', 'podcast'))),
				 'UPLOAD_ONLY'   => utf8_encode(trim(get_string('uploadOnly', 'podcast'))),
                 'PCP'   => utf8_encode(trim(get_string('pcp', 'podcast'))));
				 //UPLOAD_N_LINKING => utf8_encode(trim(get_string('uploadNLinking', 'podcast'))));

$settings->add(new admin_setting_configselect('podcast_mode', utf8_encode(get_string('mode', 'podcast')), '', 'PCP', $options));
				   
if(!strcmp($CFG->podcast_mode ,'UPLOAD_ONLY')){

	if (!is_writable( $CFG->dirroot."/mod/podcast/publication" ) ){
		$settings->add(new admin_setting_heading('test_directory_pub', get_string('writable_directory_publication','podcast'), ''));
	}else{
		$settings->add(new admin_setting_heading('test_directory_pub', get_string('nowritable_directory_publication','podcast'), ''));
	}
	
	if (!is_writable( $CFG->dirroot."/mod/podcast/media" ) ){
		$settings->add(new admin_setting_heading('test_directory_media', get_string('writable_directory_media','podcast'), ''));
	}else{
		$settings->add(new admin_setting_heading('test_directory_media', get_string('nowritable_directory_media','podcast'), ''));
	}
	
}elseif(!strcmp($CFG->podcast_mode ,'LINKING_ONLY')){

	//On sp�cifie le nom de la table source, nourrie par la solution de podcast.
	$settings->add(new admin_setting_heading('table_source', get_string('tablesourcehead','podcast'), ''));
	$settings->add(new admin_setting_configtext('podcast_feed', get_string('tablesource','podcast'), get_string('tablesourcedesc','podcast'), 'default_podcast_feed', $paramtype=PARAM_RAW, $size=null));
	
	//La variable ipod n'est settable � 1 que si on est en mode linking
	$settings->add(new admin_setting_heading('podcast_flux_ipod', get_string('fluxipodhead','podcast'), ''));
			   
	$settings->add(new admin_setting_configcheckbox('podcast_fluxipod', get_string('fluxipod', 'podcast'), get_string('fluxipoddesc', 'podcast'), 0, $yes='1', $no='0'));
}elseif(!strcmp($CFG->podcast_mode ,'PCP')){
    //On sp�cifie le nom de la table source, nourrie par la solution de podcast.
	$settings->add(new admin_setting_heading('table_source', get_string('tablesourcehead','podcast'), ''));
	$settings->add(new admin_setting_configtext('podcast_feed', get_string('tablesource','podcast'), get_string('tablesourcedesc','podcast'), 'default_podcast_feed', $paramtype=PARAM_RAW, $size=null));

    
    //Nom de l'utilisateur ayant des droits sur le serveur podcast producer
	$settings->add(new admin_setting_heading('PCP', get_string('pcphead','podcast'), ''));
    $settings->add(new admin_setting_configtext('podcast_path2pcp', get_string('path2pcp','podcast'), get_string('path2pcpdesc','podcast'), 'podcast.univ-nancy2.fr', $paramtype=PARAM_RAW, $size=null));
	$settings->add(new admin_setting_configtext('podcast_username', get_string('username','podcast'), get_string('usernamedesc','podcast'), 'moodle', $paramtype=PARAM_RAW, $size=null));
    $settings->add(new admin_setting_configtext('podcast_password', get_string('password','podcast'), get_string('passworddesc','podcast'), 'moodle', $paramtype=PARAM_RAW, $size=null));
    $settings->add(new admin_setting_configtext('podcast_path2rsakey', get_string('path2rsakey','podcast'), get_string('path2rsakeydesc','podcast'), '~/.ssh/id_rsa_forMoodle', $paramtype=PARAM_RAW, $size=null));
    $settings->add(new admin_setting_configcheckbox('podcast_submit', get_string('submitAD', 'podcast'), get_string('submitADdesc', 'podcast'), 1, $yes='1', $no='0'));
    if($CFG->podcast_submit){
        $settings->add(new admin_setting_configtext('podcast_path2uploadscript', get_string('path2uploadscript','podcast'), get_string('path2uploadscriptdesc','podcast'), 'http://podcast.univ-nancy2.fr/upload.php', $paramtype=PARAM_RAW, $size=null));
        $settings->add(new admin_setting_configtext('podcast_path2tmpfiles', get_string('podcast_path2tmpfiles','podcast'), get_string('podcast_path2tmpfilesdesc','podcast'), '/Users/moodle/tmp', $paramtype=PARAM_RAW, $size=null));
    }
    $settings->add(new admin_setting_configcheckbox('podcast_capture', get_string('captureAD', 'podcast'), get_string('captureADdesc', 'podcast'), 1, $yes='1', $no='0'));

    
	$settings->add(new admin_setting_heading('podcast_flux_ipod', get_string('fluxipodhead','podcast'), ''));
	$settings->add(new admin_setting_configcheckbox('podcast_fluxipod', get_string('fluxipod', 'podcast'), get_string('fluxipoddesc', 'podcast'), 0, $yes='1', $no='0'));

}

//$settings->add(new admin_setting_heading('restriction', get_string('extensions','podcast'), ''));

/*$settings->add(new admin_setting_configtext('podcast_extensions', get_string("setextensions","podcast"),
get_string('extension_empty','podcast')." ".get_podcast_mimetypes_string(), '', PARAM_TEXT)); */

$settings->add(new admin_setting_heading('onselademandebien', get_string('videosize','podcast'), ''));

$settings->add(new admin_setting_configtext('podcast_width', get_string("width","podcast"),
'', 480, PARAM_INT)); 

$settings->add(new admin_setting_configtext('podcast_height', get_string("height","podcast"),
'', 340, PARAM_INT));

$settings->add(new admin_setting_configcheckbox('podcast_image', get_string('showimage', 'podcast'), get_string('showimagedesc', 'podcast'), 0, $yes='1', $no='0'));

?>